package com.define.ssh.dao.impl;

import org.springframework.stereotype.Repository;

import com.define.ssh.dao.SysPowerDao;
import com.define.ssh.model.SysPower;

@Repository("sysPowerDaoImpl")
public class SysPowerDaoImpl extends BaseDaoImpl<SysPower, Integer> implements
		SysPowerDao {

	@Override
	public Integer gmcount(Integer pid) {
		Integer i=0;
		System.out.println(pid);
		String sql = "select count(*) from compdept where pid=" + pid;
		Object  cdCount=getSession().createSQLQuery(sql).uniqueResult();
		
		String sql1 = "select count(*) from deptuser where deptid=" + pid;
		Object  deCount=getSession().createSQLQuery(sql1).uniqueResult();
		
		i=i+Integer.valueOf(cdCount.toString());
		i=i+Integer.valueOf(deCount.toString());
		return i;
	}

}
